package com.zheng.russiaRec.model 
{
	import com.zheng.russiaRec.model.utils.U_DisposeArr;
	import com.zheng.russiaRec.model.utils.U_DropOut;
	import com.zheng.russiaRec.model.utils.U_GetRecVoFromArr;
	
	/**
	 * @describe  	固定积木proxy
	 * @author  	rrDog
	 * @website 	http://blog.sina.com.cn/zihua2007
	 * @time		... 
	 */
	public class P_FixedGroup
	{
		private var _fixedGridGroup:Array;
		private var _fixedToGroup:Array;
		//功能===============================================================
		private var _dropOut:U_DropOut;
		private var _disposeArr:U_DisposeArr;
		private var _getRecFromArr:U_GetRecVoFromArr;
		
		public function P_FixedGroup() 
		{
			_fixedGridGroup = [];
			_fixedToGroup = [];
			_dropOut = new U_DropOut();
			_disposeArr=new U_DisposeArr();
			_getRecFromArr=new U_GetRecVoFromArr();
		}
		/**
		 * 获取fixedGroup中最小的行数
		 * @param	maxNum	最大值
		 * @return
		 */
		public function getFixedMinLine(maxNum:int):int {
			var recArr:Array;
			var minNum:int=maxNum;
			for (var name:String in _fixedGridGroup) 
			{
				recArr = _fixedGridGroup[name] as Array;
				if (minNum > recArr[1]) {
					minNum=recArr[1]
				}
			}
			return minNum;
		}
		/**
		 * 被指定的行是否都被填满
		 * @param	row	行长度
		 * @param	num	指定行数
		 * @return
		 */
		public function getFullLine(row:int,num:int):Array {
			var recArr:Array;
			var tempArr:Array = [];
			for (var i:int = 0; i < row; i++) 
			{
				recArr = _getRecFromArr.getRecVoFromArr(_fixedGridGroup, i, num);
				if (recArr == null) {
					_disposeArr.disposeArr(tempArr);
					return null;
				}
				tempArr.push(recArr);
			}
			return tempArr;
		}
		/**
		 * 悬空的rec下落
		 * @param 	arr		要处理的数组这里是fixedToGroup
		 * @param	numArr	消除的行
		 */
		public function moveHangRec(arr:Array,numArr:Array):void {
			if (numArr==null||numArr.length==0) return;
			_dropOut.dropOutRec(arr, numArr);
		}
		public function get fixedGridGroup():Array { return _fixedGridGroup; }
		public function set fixedGridGroup(value:Array):void{
			_fixedGridGroup=value;
		}
		public function get fixedToGroup():Array { return _fixedToGroup; }
		public function set fixedToGroup(value:Array):void{
			_fixedToGroup=value;
		}
	}
	
}